/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package conventus;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Leonardo
 */
@Entity
@Table(name = "historicos", catalog = "conventus", schema = "")
@NamedQueries({
    @NamedQuery(name = "Historicos.findAll", query = "SELECT h FROM Historicos h"),
    @NamedQuery(name = "Historicos.findByCodHistorico", query = "SELECT h FROM Historicos h WHERE h.codHistorico = :codHistorico"),
    @NamedQuery(name = "Historicos.findByCodTopico", query = "SELECT h FROM Historicos h WHERE h.codTopico = :codTopico"),
    @NamedQuery(name = "Historicos.findByCodMembro", query = "SELECT h FROM Historicos h WHERE h.codMembro = :codMembro"),
    @NamedQuery(name = "Historicos.findByDatLanc", query = "SELECT h FROM Historicos h WHERE h.datLanc = :datLanc")})
public class Historicos implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "COD_HISTORICO")
    private Integer codHistorico;
    //TOPICOS
    @JoinColumn(name="COD_TOPICO",referencedColumnName="COD_TOPICO")
    @ManyToOne
    private Topicos codTopico;
    //MEMBROS
    @JoinColumn(name="COD_MEMBRO",referencedColumnName="COD_MEMBRO")
    @ManyToOne
    private Membros codMembro;
    @Basic(optional = false)
    @Column(name = "DAT_LANC")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datLanc;
    @Basic(optional = false)
    @Lob
    @Column(name = "HISTORICO")
    private String historico;

    public Historicos() {
    }

    public Historicos(Integer codHistorico) {
        this.codHistorico = codHistorico;
    }

    public Historicos(Integer codHistorico, Topicos codTopico, Membros codMembro, Date datLanc, String historico) {
        this.codHistorico = codHistorico;
        this.codTopico = codTopico;
        this.codMembro = codMembro;
        this.datLanc = datLanc;
        this.historico = historico;
    }

    public Integer getCodHistorico() {
        return codHistorico;
    }

    public void setCodHistorico(Integer codHistorico) {
        Integer oldCodHistorico = this.codHistorico;
        this.codHistorico = codHistorico;
        changeSupport.firePropertyChange("codHistorico", oldCodHistorico, codHistorico);
    }

    public Topicos getCodTopico() {
        return codTopico;
    }

    public void setCodTopico(Topicos codTopico) {
        Topicos oldCodTopico = this.codTopico;
        this.codTopico = codTopico;
        changeSupport.firePropertyChange("codTopico", oldCodTopico, codTopico);
    }

    public Membros getCodMembro() {
        return codMembro;
    }

    public void setCodMembro(Membros codMembro) {
        Membros oldCodMembro = this.codMembro;
        this.codMembro = codMembro;
        changeSupport.firePropertyChange("codMembro", oldCodMembro, codMembro);
    }

    public Date getDatLanc() {
        return datLanc;
    }

    public void setDatLanc(Date datLanc) {
        Date oldDatLanc = this.datLanc;
        this.datLanc = datLanc;
        changeSupport.firePropertyChange("datLanc", oldDatLanc, datLanc);
    }

    public String getHistorico() {
        return historico;
    }

    public void setHistorico(String historico) {
        String oldHistorico = this.historico;
        this.historico = historico;
        changeSupport.firePropertyChange("historico", oldHistorico, historico);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codHistorico != null ? codHistorico.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Historicos)) {
            return false;
        }
        Historicos other = (Historicos) object;
        if ((this.codHistorico == null && other.codHistorico != null) || (this.codHistorico != null && !this.codHistorico.equals(other.codHistorico))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "conventus.Historicos[ codHistorico=" + codHistorico + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
